#include <cstdlib>
#include <iostream>

using namespace std;

#include "recovery/RecoveryManager.h"
#include "Redundancy/CRCWorker.h"
#include "Redundancy/CRCBlocks.h"

using namespace ::miniprojeto::Redundancy;

using namespace ::miniprojeto::recovery;

int main (int argc, char** argv) {
	/*
	ifstream in(argv[1], ios::binary);
	unsigned char* buffer = new unsigned char[4098];
	in.read((char*) buffer, 1055);
	for (int i = 1055 -1 ; i < 4098; i++) {
		buffer[i] = i%2;	
	}
	//int blockSpecialSize = 4098;
	//in.read((char*) buffer, 4098);
	CRCBlocks* b = new CRCBlocks(buffer, 4098, 0);
	CRCWorker* w = new CRCWorker();
	w->setCRCBlock(b);
	cerr<<"Reminder do block inicial: "<<b->getReminder()<<endl;
	assert(w);
	assert(b);
	w->setCRCBlock(b);
	cerr<<"passou pelo w->setCRECBlock()"<<endl;
	w->run();
	cerr<<"Novo Reminder do block: "<<(w->getCRCBlocks()->getReminder())<<endl;
	b = w->getCRCBlocks();
	cerr<<"Valor de Reminder de b: "<<b->getReminder()<<endl;
	w->setCRCBlock(b);
	w->run();
	cerr<<"Novo Reminder do block: "<<(w->getCRCBlocks()->getReminder())<<endl;*/
	RecoveryManager* rec = new RecoveryManager();
	rec->setTargetFile(argv[1]);
	rec->init();
	return 0;
}
